package redis

import (
	"context"
	"log"
	"project05_web/src/global"
)

const (
	KeyUserIdSet = "CACHE/users/"
	KeyPostIdSet = "CACHE/posts/"
	CACHE_POSTS  = "CACHE/all-posts"
	CACHE_USERS  = "CACHE/all-users"
)

func ExistKey(key string) bool {
	n, err := global.RedisDb.Exists(context.Background(), key).Result()
	if err != nil {
		log.Println("find exist user Key error :", err)
	}
	if n == 0 {
		log.Println(key, "key no exist")
		return false
	}
	log.Println(key, "key exist")
	return true
}
